package com.zhangyj.security;

import java.io.Serializable;

public class Permission implements Serializable {
	private static final long serialVersionUID = -8813739772692446550L;

	public static final int VIEW = 1;
	public static final int ADD = VIEW << 1;
	public static final int UPDATE = ADD << 1;
	public static final int DELETE = UPDATE << 1;

	private int funcId;
	private int action = 0;

	public Permission() {
		this(0, 0);
	}

	public Permission(int funcId, int action) {
		this.setFuncId(funcId);
		this.setAction(action);
	}

	public int getFuncId() {
		return funcId;
	}

	public void setFuncId(int funcId) {
		this.funcId = funcId;
	}

	public int getAction() {
		return action;
	}

	public void setAction(int action) {
		this.action = action;
	}

	public void addAction(int action) {
		this.action = this.action | action;
	}
}
